﻿package com.nana.petadventure.controller
{
	import com.nana.petadventure.app.AppControllerList;
	import com.nana.petadventure.app.AppView;
	import com.nana.petadventure.event.SceneEvent;
	import com.nana.petadventure.model.obj.FlyerObj;
	import com.nana.petadventure.ui.pet.Pet;
	import com.nana.petadventure.ui.scene.SceneView;
	import com.nana.petadventure.utils.GameLogicManager;
	
	import flash.display.SimpleButton;
	import flash.events.MouseEvent;
	
	public class SceneController
	{
		
		private var _sceneView:SceneView;
		private var _pauseBtn:SimpleButton;
		private var _gameType:String;
		private var _accelerateUp:Number;
		private var _accelerateDown:Number;	// 
		
		public function SceneController()
		{
		}
		
		public function init():void {
			_sceneView = new SceneView();
			AppView.getInstance().sceneLayer.addChild(_sceneView);
			
			_pauseBtn = new SimpleButton();
			AppView.getInstance().uiLayer.addChild(_pauseBtn);
			_pauseBtn.x = 930;
			_pauseBtn.y = 10;
			_pauseBtn.addEventListener(MouseEvent.CLICK, onPauseHandler);
			
			this.startGame();
		}
		
		private function onPauseHandler(event:MouseEvent):void {
			AppControllerList.getInstance().gameController.showOptionBox();
		}
		
		public function startGame():void {
			_sceneView.reloadScene();
		}
		
		public function initWithGameType(type:String):void {
			_gameType = type;
		}
		
		private function initSceneListeners():void {
		}
		
		public function pauseGame():void {
			
		}
		
		public function clearScene():void {
			
		}
		
		public function destroy():void {
			AppView.getInstance().sceneLayer.removeChild(_sceneView);
			_sceneView = null;
			
			AppView.getInstance().uiLayer.removeChild(_pauseBtn);
			_pauseBtn = null;
			
		}
	}
}